package vos.vn;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

public class CustomComponents_switchOFActivity extends Activity implements OnTouchListener{   
	CustomSwitch customView;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);               
        customView =  (CustomSwitch) findViewById(R.id.customView);    
        customView.setOnTouchListener(this);
    }
    
	@Override
	public boolean onTouch(View v, MotionEvent event) {		
		if(customView.isOn()) {
			customView.changeImage(R.drawable.switch_off);
			customView.setOn(false);
		} else {
			customView.changeImage(R.drawable.switch_on);
			customView.setOn(true);
		}
		return false;
	}
}